#pragma once
#include "Common.h"

class PageCache
{
public:
	static PageCache* GetInstance()
	{
		return &_sInst;
	}

	Span* NewSpan(size_t);

	void ReleaseSpanToPageCache(Span*);

	Span* MapObjectToSpan(void*);

	std::mutex _pageMtx;
private:
	PageCache() {};
	PageCache(const PageCache&) = delete;
	SpanList _spanLists[NPAGES];
	static PageCache _sInst;
	std::unordered_map<PAGE_ID, Span*> _idSpanMap;
};